package com.xlr.excel.task;

import com.xlr.excel.entity.SourseVehicle;
import com.xlr.excel.service.SourseVehicleService;
import com.xlr.excel.util.SpringContextUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: xlr
 * @Date: Created in 下午7:49 2019/3/3
 */
public class QueueCoreThread implements Runnable {


    SourseVehicleService sourseVehicleService = SpringContextUtils.getBean( SourseVehicleService.class );

    List<SourseVehicle> list = new ArrayList <>(  );
    public QueueCoreThread(List<SourseVehicle> list){
        this.list =  list;
    }
    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        sourseVehicleService.insertBatch(list);
    }
}
